package com.zmn.plat.admin.controller.part.category.first;

import java.util.List;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.zmn.common.constant.GlobalConsts;
import com.zmn.common.constant.StatusConsts;
import com.zmn.common.dto.LayuiTableResponseDTO;
import com.zmn.plat.admin.controller.part.PartBaseController;
import com.zmn.plat.model.entity.part.PartCategory;
import com.zmn.plat.model.entity.part.PartCategoryQuery;

/**
 * @Auther: admin
 * @since: 2018/10/16 11:23
 * @Description:
 */

@RestController
@RequestMapping("/part/category/first/ajax")
public class PartCategoryFirstAjaxController extends PartBaseController {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    /**
     * 描述: [Layui] 加载数据表格
     *
     * @author DaiZhichao
     * @since 2018/11/6 20:54
     */
    @SuppressWarnings("Duplicates")
    @RequestMapping(value = "/list", produces = "application/json; charset=utf-8")
    @RequiresPermissions("/part/category/first/list.action")
    public LayuiTableResponseDTO partCategoryList(PartCategoryQuery query) {
        query.setParentId(GlobalConsts.TOP_ID);

        List<PartCategory> scmSupplierList = partCategoryService.listPageByQuery(query);

        return new LayuiTableResponseDTO<>(StatusConsts.STATUS_SUCCESS, "SUCCESS", query.getTotalCount(), scmSupplierList);
    }

}
